{extend name="public:base"}
{block name='css'}
{/block}
{block name='body'}
<div class="view view-main white-navbar white-page white-toolbar">
    <div data-name="home" class="page">
        <div class="navbar nabar">
            <div class="navbar-inner">
                <div class="left"></div>
                <div class="center"><span>首页</span></div>
                <div class="right"></div>
            </div>
        </div>
        <div class="serach seach">
            <form name="form" action="" id="form" method="post" >
                <div class="m">
                    <div class="ico"></div>
                    <div class="key"><input type="text" name="keywords" placeholder="请输入关键字搜索" /></div>
                </div>
                <div class="sub"><input type="submit" value="搜索" /></div>
            </form>
        </div>
        <div class="page-content padding-bottom50 infinite-scroll-content" style="padding-top:0;">
            <div class="swiper-container home-swiper-container">
                <div class="swiper-pagination home-swiper-pagination"></div>
                <div class="swiper-wrapper">
                    {volist name='slides' id='vo'}
                    <div class="swiper-slide"><img src="{$vo.img}" /></div>
                    {/volist}
                </div>
            </div>

            <!-- 公告 -->
            <div class="announcement">
                <img src="__STATIC__/new/image/gonggao.png" alt="">
                <div class="swiper mySwiper" id="anucent">
                <div class="swiper-pagination home-goods-swiper-pagination"></div>
                    <div class="swiper-wrapper spwer" id="swiper-wrapper1">
                        {volist name='news' id='vo'}
                      <div class="swiper-slide swse" id="swiper-slide1"><a onclick="location.href='/new_info?id={$vo.id}'">{$vo.title}</a></div>
                      {/volist}
                      <!-- <div class="swiper-slide swse" id="swiper-slide1">公告2</div>
                      <div class="swiper-slide swse" id="swiper-slide1">公告3</div> -->
                    </div>
                </div>
            </div>
            <!-- <div class="home-goods-title"><img src="__PUBLIC__/img/a2.png" /> 精品推荐</div>
            <div class="swiper-container home-goods-swiper">
                <div class="swiper-pagination home-goods-swiper-pagination"></div>
                <div class="swiper-wrapper">
                    {volist name='goods_list' id='vo'}
                    <div class="swiper-slide">
                        <a href="{:url('goods',['id'=>$vo['id']])}" class="external" ><img src="{$vo.img}" /></a>
                        <p class="p1">{$vo.title}</p>
                        <p class="p2">￥{$vo.unit_price}</p>
                    </div>
                    {/volist}
                </div>
            </div> -->

            <div class="bakcground-10"></div>

            <div class="home-newsgoods-title"><img src="__PUBLIC__/img/a3.png" /> 新品推荐</div>

            <div class="home-goods-ul">
            </div>
            {include file='public:loading' /}
        </div>

        {include file='public:tab' /}
    </div>
</div>
{/block}

{block name="js"}
<!-- <script src="__STATIC__/new/swiper-bundle.min.js"></script> -->

<script type="text/javascript">
    
    $(function(){
        var mySwiper = new Swiper('.home-swiper-container', {
            autoplay: {
                delay: 3000,
                disableOnInteraction: false,

            },
            pagination: {
                el: '.home-swiper-pagination'
            }
        });
        var swiper = new Swiper("#anucent", {
        direction: "vertical",
        autoplay: {
            delay: 2500,
            disableOnInteraction: false,
        },
        
      })
        var mySwiper1 = new Swiper('.home-goods-swiper', {
            autoplay: {
                delay: 3000
            },
            pagination: {
                el: '.home-goods-swiper-pagination'
            },
            slidesPerView : 3
        });

        $("#form").validate({
            rules: {
                keywords: "required"
            },
            messages: {
                keywords: '请输入关键字'
            },
            showErrors: function (errorMap, errorList) {
                $.each(errorList, function (i, v) {
                    messageToast( v.message );
                    return false;
                });
            },
            onfocusout: false,
            onsubmit : true ,
            onkeyup : false ,
            onclick : false ,
            focusInvalid:false,
            submitHandler:function(){
                var keywords = $('input[name=keywords]').val();
                window.location.href = "{:url('index/search_goods')}?keywords="+keywords;
            }
        });

        getGoodsList('', 2);

    });

    //触发无限滚动
    $$('.infinite-scroll-content').on('infinite', function () {
        getGoodsList('', 2);
    });
</script>
{/block}